﻿Namespace nHibernate.Models
    Public Class PaymentMethodeModel
        Public Sub New()

        End Sub
        Public Overridable Property Name As String
        Public Overridable Property Text As String
        Public Overridable Property Reduction As Decimal

        Public Overridable Function ToPaymentMethode() As PaymentMethode
            If Not Name = "-1" Then
                Return New PaymentMethode(Name, Text, Reduction)
            End If
            Return Nothing
        End Function

        Public Shared Function FromPaymentMethode(p As PaymentMethode) As PaymentMethodeModel
            If p IsNot Nothing Then
                Return New PaymentMethodeModel With {.Name = p.Name, .Reduction = p.Reduction, .Text = p.Text}
            End If
            Return New PaymentMethodeModel With {.Name = "-1"}
        End Function
    End Class

    Public Class OrderTextModel
        Public Overridable Property Name As String
        Public Overridable Property Text As String

        Public Overrides Function Equals(obj As Object) As Boolean
            Try
                Dim item As OrderTextModel = obj
                If item.Name = Name Then
                    Return True
                Else
                    Return False
                End If
            Catch : Return False : End Try
        End Function
    End Class
End Namespace
